home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
qwik40.arc
/
QBENCH.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-01-09
|
8KB
|
270 lines
{ Qbench.pas - produces a 'Screens/second' table for ver 4.0, 12-01-87 }
{ QWIK Screen utilities. }
{ I'm not trying to support this program, so don't expect it to be perfect.
It will just give you a good feel for speed. The time is adjusted for
an average 8 second test for each condition - total of 112 seconds. For
more accurate results, change TestTime:=16. Or for a quicker but less
accurate test, change TestTime:=1. }
uses Crt, {$U Qwik40.tpu} Qwik;
{$i timerd12.inc}
type
Attrs = (Attr,NoAttr);
const
Procs = 9;
TestTime = 8; { TestTime in seconds for each case. 8 gives +/- 1% }
var
Attrib, Count, Screens: integer;
OldCursor: word;
Row, Col, Rows, Cols, ProcNumber: byte;
ScrPerSec: array[1..Procs] of array[Attr..NoAttr] of real;
Strng: string[80];
A: Attrs;
ScrArray: array[1..4000] of byte;
Names: array[1..Procs] of string[80];
FV: text;
ToDisk: boolean;
Ch: char;
procedure CheckCursor;
var CursorMode: integer absolute $0040:$0060;
begin
if ActiveDispDev=MdaMono then
if CursorMode=$0607 then
CursorChange($0B0C,OldCursor);
end;
procedure CheckTime;
begin
Strng:='TimerTest ';
for Col:=1 to 3 do Strng:=Strng+Strng;
Qfill (1,1,25,80,14,' ');
timer (start);
for Count:=1 to Screens do
for row:=1 to 25 do
Qwrite (Row,1,14,Strng);
timer (Stop);
Screens:=trunc(Screens*TestTime/ElapsedTime);
end;
procedure WritesFillsProcedures (ProcNumber: byte);
begin
case ProcNumber of
1: begin
timer (start);
for Count:=1 to Screens do
for Row:=1 to 25 do
Qwrite (Row,1,Attrib,Strng);
timer (Stop);
end;
2: begin
timer (start);
for Count:=1 to Screens do
for Row:=1 to 25 do
QwriteC (Row,1,80,Attrib,Strng);
timer (Stop);
end;
3: begin
timer (start);
for Count:=1 to Screens do
for Row:=1 to 25 do
QwriteA (Row,1,Attrib,80,Strng[1]);
timer (Stop);
end;
4: begin
timer (start);
for Count:=1 to Screens do
QfillC (1,1,80,25,80,Attrib,'C');
timer (Stop);
end;
5: begin
timer (start);
for Count:=1 to Screens do
Qfill (1,1,25,80,Attrib,'F');
timer (Stop);
end;
end; { Case ProcNumber of }
if Attrib>=0 then
case ProcNumber of
6: begin
Qfill (1,1,25,80,Attrib,'a');
timer (start);
for Count:=1 to Screens do
Qattr (1,1,25,80,Attrib);
timer (Stop);
end;
7: begin
Qfill (1,1,25,80,Attrib,'c');
timer (start);
for Count:=1 to Screens do
QattrC (1,1,80,25,80,Attrib);
timer (Stop);
end;
end; { Case ProcNumber of }
if ElapsedTime<>0.0 then
ScrPerSec[ProcNumber,A]:=Screens/ElapsedTime;
end;
procedure StoresProcedures (ProcNumber: byte);
begin
for Row:=1 to 25 do
Qwrite (Row,1,Attrib,Strng);
case ProcNumber of
8: begin
timer (start);
for Count:=1 to Screens do
QstoreToMem (1,1,25,80,ScrArray);
timer (Stop);
end;
9: begin
QstoreToMem (1,1,25,80,ScrArray);
timer (start);
for Count:=1 to Screens do
QstoreToScr (1,1,25,80,ScrArray);
timer (Stop);
end;
end; { Case ProcNumber of }
ScrPerSec[ProcNumber,A]:=Screens/ElapsedTime;
end;
procedure LoopWritesFills (At: Attrs; Att: integer);
begin
A:=At;
Attrib:=Att;
for ProcNumber:=1 to 7 do
begin
Strng:=Names[ProcNumber];
if Qsnow then
Strng:=Strng+' Wait '
else Strng:=Strng+' No Wait ';
if A=Attr then
Strng:=Strng+' w/Attr '
else Strng:=Strng+' No Attr ';
fillchar (Strng[32],49,ProcNumber+48);
Strng[0]:=#80;
WritesFillsProcedures (ProcNumber);
end;
end;
procedure LoopStores (At: Attrs; Att: integer);
begin
A:=At;
Attrib:=Att;
for ProcNumber:=8 to 9 do
begin
Strng:=Names[ProcNumber];
if Qsnow then
Strng:=Strng+' Wait '
else Strng:=Strng+' No Wait ';
Strng:=Strng+' w/Attr ';
fillchar (Strng[32],49,ProcNumber+48);
Strng[0]:=#80;
StoresProcedures (ProcNumber);
end;
end;
begin
Qfill (1,1,25,80,14,' ');
if Qsnow then
begin
Qsnow:=false;
GotoRC (12,52);
repeat
repeat
QwriteC (12,1,80,-1,'Do you see snow? [Y/N]?');
until Keypressed;
Ch:=ReadKey;
until Ch in ['Y','y','N','n'];
case upcase(Ch) of
'Y': Qsnow:=true;
'N': begin
QwriteC (10,1,80,-1,'Congratulations! You have a card better');
QwriteC (11,1,80,-1,'than the standard IBM CGA.');
QwriteC (12,1,80,-1,'However, to make it faster, you will need');
QwriteC (13,1,80,-1,'to set Qsnow:=false manually.');
QwriteC (14,1,80,-1,'Please contact me about this.');
QwriteC (16,1,80,-1,'Press any key ...');
GotoRC (16,49);
Ch:=ReadKey;
if Ch=#00 then Ch:=ReadKey;
end;
end;
end;
Qfill (1,1,25,80,14,' ');
QwriteC (12,1,80,-1,'Data to Screen or Disk [s/d]?');
GotoRC (12,55);
repeat
Ch:=ReadKey;
until Ch in ['S','s','D','d',^M];
if upcase(Ch)='D' then
ToDisk:=true
else ToDisk:=false;
CheckCursor;
CursorOff;
Qfill (1,1,1,80,14,' ');
for ProcNumber:=1 to Procs do
for A:= Attr to NoAttr do
ScrPerSec[ProcNumber,A]:=0.0;
Names[1]:= ' Qwrite ';
Names[2]:= ' QwriteC ';
Names[3]:= ' QwriteA ';
Names[4]:= ' QfillC ';
Names[5]:= ' Qfill ';
Names[6]:= ' Qattr ';
Names[7]:= ' QattrC ';
Names[8]:= ' QstoreToMem ';
Names[9]:= ' QstoreToScr ';
if Qsnow then
Screens:=8 { First guess for screens }
else Screens:=80; { First guess for screens }
CheckTime;
LoopWritesFills (Attr, 14);
LoopStores (Attr, 14);
Qattr (1,1,25,80,7);
LoopWritesFills (NoAttr, -1);
Qfill (1,1,25,80,14,' ');
if ToDisk then
assign (FV,'Qbench.dta')
else assignCRT (FV);
rewrite (FV);
GotoRC (1,1);
writeln (FV,'S C R E E N S / S E C O N D');
writeln (FV,' Chng');
writeln (FV,'Procedure Attr S/sec');
writeln (FV,'--------- ---- -----');
for ProcNumber:=1 to 5 do
for A:=Attr to NoAttr do
begin
if A=Attr then
write (FV,Names[ProcNumber])
else write (FV,' ');
if A=Attr then
write (FV,'Yes ')
else write (FV,'No ');
writeln (FV,ScrPerSec[ProcNumber,A]:5:1);
end;
for ProcNumber:=6 to 9 do
begin
write (FV,Names[ProcNumber]);
if ProcNumber<10 then
write (FV,'Yes ')
else write (FV,'n/a ');
writeln (FV,ScrPerSec[ProcNumber,Attr]:5:1);
end;
GotoRC (21,1);
writeln (FV,'SystemID = ',SystemID);
writeln (FV,'SubModelID = ',SubmodelID);
writeln (FV,'Wait-for-retrace = ',Qsnow);
writeln (FV,'Screens/test = ',Screens);
close (FV);
GotoRC (24,1);
CursorOn;
end.